<template>
	<div class="pdf">
		<div class="pdffile" :height="screenHeight" v-show="pdffile">
			<img src="../../static/image/closepdf.png" class="closeimg" @click="closePdfView" />

			<iframe :src="pdffile" class="pdffile" :height="screenHeight"> </iframe>
		</div>
	</div>
</template>
<script>
export default {
	props: {
		responseViewResource: {
			type: Function,
			default: null
		},
		cmdId: {
			type: Number,
			required: true,
			default: () => 0
		},
		clientId: {
			type: String,
			required: true,
			default: () => ''
		},
		pdffile: {
			type: String,
			required: true,
			default: () => ''
		}
	},
	data() {
		return {
			screenHeight: window.innerHeight
		};
	},
	created() {},
	mounted() {},
	methods: {
		closePdfView() {
			this.responseViewResource(
				this.cmdId,
				'done',
				undefined,
				this.clientId,
				res => {
					console.log(res, 'close pdf view success');
				},
				err => {
					console.log(err, 'close pdf view error');
				}
			);
			this.$emit('closePdfView');
		}
	}
};
</script>
<style scoped>
.pdffile {
	width: 100%;
	/*height:600px;*/
	position: absolute;
	left: 0;
	top: 0px;
	z-index: 12;
}
.closeimg {
	width: 30px;
	height: 30px;
	position: absolute;
	right: 10px;
	top: 50px;
	z-index: 20;
}
</style>
